package com.atguigu.spzx.cloud.user.service.impl;
import com.atguigu.spzx.cloud.api.client.OrderFeignClient;
import com.atguigu.spzx.cloud.model.entity.Order;
import com.atguigu.spzx.cloud.model.entity.User;
import com.atguigu.spzx.cloud.user.mapper.UserMapper;
import com.atguigu.spzx.cloud.user.service.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author ChenXing
 * @Description
 * @Create 2024/7/22 16:22
 */

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private OrderFeignClient orderFeignClient;

    @Override
    public User findUserByUserId(Long userId) {
        User user = userMapper.selectUserByUserId(userId);
        List<Order> orderListById = orderFeignClient.findOrderListById(userId);
        System.out.println(orderListById);
        user.setOrderList(orderListById);
        return user;
    }
}
